Function Prototype/Declaration

What is a Function Prototype?

A function prototype (also called a function declaration) is a declaration of a function, informing the compiler about the function's return type, name, and the types of its arguments before the function's actual definition.

Syntax

return_type function_name(parameter1_type parameter1, parameter2_type parameter2, ...);

Example

int addNumbers(int a, int b); // Function prototype

int main() 
{
    int result = addNumbers(10, 20);
    printf("Result: %d\n", result);
    return 0;
}

int addNumbers(int a, int b) 
{ 
    return a + b;
}